<!DOCTYPE html>
<html>
<head>
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?d890b1f16fb364253e79c5bb20225c3a";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>


    

    

    
<!-- Baidu Tongji -->
<script>var _hmt = _hmt || []</script>
<script async src="//hm.baidu.com/hm.js?busuanzi_value_site_uv"></script>
<!-- End Baidu Tongji -->




    <meta charset="utf-8">
    <meta name="baidu-site-verification" content="FYMCShbUK8" />
    <meta name="baidu-site-verification" content="ZYRF7OxQRW" />
    <meta name="baidu-site-verification" content="cHSqtjI0PN" />
    <meta name="baidu-site-verification" content="cHSqtjI0PN" />
    <meta name="baidu-site-verification" content="cHSqtjI0PN" />
    
    
    <link rel="canonical" href="https://hhardyy.com/2020/07/19/vite秒开揭秘/">
    
    
    <title>vite秒开揭秘 | 小方块 - hhardyy.com | 复杂的坑+归其原理+了解实现规则===解决？解决成功：加油解决成功;</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#958e93">
    
    
    <meta name="keywords" content="vue3,vite">
    <meta name="description" content="尤雨溪直播介绍vue3的时候，说到了他正在做的一个新东西，名叫vite。">
<meta name="keywords" content="vue3,vite">
<meta property="og:type" content="article">
<meta property="og:title" content="vite秒开揭秘">
<meta property="og:url" content="http://yoursite.com/2020/07/19/vite秒开揭秘/index.html">
<meta property="og:site_name" content="小方块 - hhardyy.com">
<meta property="og:description" content="尤雨溪直播介绍vue3的时候，说到了他正在做的一个新东西，名叫vite。">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="http://yoursite.com/images/vite/0.jpg">
<meta property="og:image" content="http://yoursite.com/images/vite/01.jpg">
<meta property="og:image" content="http://yoursite.com/images/vite/1.png">
<meta property="og:image" content="http://yoursite.com/images/vite/2.png">
<meta property="og:image" content="http://yoursite.com/images/vite/4.png">
<meta property="og:image" content="http://yoursite.com/images/vite/5.png">
<meta property="og:image" content="http://yoursite.com/images/vite/5.1.png">
<meta property="og:image" content="http://yoursite.com/images/vite/6.png">
<meta property="og:image" content="http://yoursite.com/images/vite/8.jpg">
<meta property="og:updated_time" content="2020-07-18T20:45:13.077Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="vite秒开揭秘">
<meta name="twitter:description" content="尤雨溪直播介绍vue3的时候，说到了他正在做的一个新东西，名叫vite。">
<meta name="twitter:image" content="http://yoursite.com/images/vite/0.jpg">
    
        <link rel="alternate" type="application/atom+xml" title="小方块 - hhardyy.com" href="/atom.xml">
    
    <link rel="shortcut icon" href="/hardyfavicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/paulGraham.jpg)">
      <div class="brand" style="background-color:#4154b2">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">BingZhenhuang</h5>
          <a href="mailto:huangbingzhen@hhardyy.com" title="huangbingzhen@hhardyy.com" class="mail">huangbingzhen@hhardyy.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                所有文章
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/HHardyy" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://gitee.com/hhardyy" target="_blank" >
                <i class="icon icon-lg icon-cloud"></i>
                Gitee
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://juejin.im/user/59a26f926fb9a02487553b04"  >
                <i class="icon icon-lg icon-pencil"></i>
                掘金-圳
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://segmentfault.com/u/hhardyy"  >
                <i class="icon icon-lg icon-comments"></i>
                Segmentfault
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://codepen.io/HHardyy/" target="_blank" >
                <i class="icon icon-lg icon-codepen"></i>
                Codepen
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://www.freecodecamp.cn/hhardyy" target="_blank" >
                <i class="icon icon-lg icon-leaf"></i>
                Freecodecamp
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/友情链接"  >
                <i class="icon icon-lg icon-link"></i>
                友链
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">vite秒开揭秘</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">vite秒开揭秘</h1>
        <h5 class="subtitle">
            
                <time datetime="2020-07-18T20:03:48.000Z" itemprop="datePublished" class="page-time">
  2020-07-19
</time>


            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#vite是什么"><span class="post-toc-number">1.</span> <span class="post-toc-text">vite是什么</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#如何使用vite"><span class="post-toc-number">2.</span> <span class="post-toc-text">如何使用vite</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#简单解释一波"><span class="post-toc-number">3.</span> <span class="post-toc-text">简单解释一波</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#为什么import的vue资源变成了-modules"><span class="post-toc-number">4.</span> <span class="post-toc-text">为什么import的vue资源变成了/@modules?</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#为什么-modules之后资源就可用了？"><span class="post-toc-number">5.</span> <span class="post-toc-text">为什么/@modules之后资源就可用了？</span></a></li></ol>
        </nav>
    </aside>
    
<article id="post-vite秒开揭秘"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">vite秒开揭秘</h1>
        <div class="post-meta">
            <time class="post-time" title="2020-07-19 04:03:48" datetime="2020-07-18T20:03:48.000Z"  itemprop="datePublished">2020-07-19</time>

            


            

        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <p>尤雨溪直播介绍vue3的时候，说到了他正在做的一个新东西，名叫vite。</p>
<p><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="86" src="//music.163.com/outchain/player?type=2&id=1453143575&auto=0&height=66"></iframe><br><a id="more"></a></p>
<p>已经有几个月没有写博客了，疫情期间沉迷游戏，虽然也不忘记学习但还是多少有些罪恶感，接下来应该会恢复之前的状态，跑步，学习，看书。</p>
<p>开武魂，直入主题。。。<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/0.jpg" alt="" title="">
                </div>
                <div class="image-caption"></div>
            </figure></p>
<h2 id="vite是什么"><a href="#vite是什么" class="headerlink" title="vite是什么"></a>vite是什么</h2><p>vite: 一个基于 Vue3 单文件组件的非打包开发服务器</p>
<p>作者在直播中是这么说的：“Vite，一个基于浏览器原生 ES imports 的开发服务器。利用浏览器去解析 imports，在服务器端按需编译返回，完全跳过了打包这个概念，服务器随起随用。同时不仅有 Vue 文件支持，还搞定了热更新，而且热更新的速度不会随着模块增多而变慢。针对生产环境则可以把同一份代码用 rollup 打包。虽然现在还比较粗糙，但这个方向我觉得是有潜力的，做得好可以彻底解决改一行代码等半天热更新的问题。“<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/01.jpg" alt="vue3 beta直播" title="">
                </div>
                <div class="image-caption">vue3 beta直播</div>
            </figure><br>优点就是：<br><br>Lightning fast cold server start<br><br>Instant hot module replacement (HMR)<br><br>True on-demand compilation<br><br>请阅读并背诵文档<a href="https://github.com/vitejs/vite" target="_blank" rel="external">https://github.com/vitejs/vite</a></p>
<h2 id="如何使用vite"><a href="#如何使用vite" class="headerlink" title="如何使用vite"></a>如何使用vite</h2><p>1、全局安装<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install create-vite-app -g</div></pre></td></tr></table></figure></p>
<p>2、创建vite项目<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">create-vite-app demo  |  npm init vite demo(非全局)</div><div class="line"><span class="built_in">cd</span> demo</div><div class="line">npm install</div></pre></td></tr></table></figure></p>
<p>3、运行<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm run dev (生产环境基于Rollup)</div></pre></td></tr></table></figure></p>
<p>一个vite项目就建好了，默认跑在3000端口<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/1.png" alt="" 运行效果""="" title="">
                </div>
                <div class="image-caption">"运行效果"</div>
            </figure></p>
<h2 id="简单解释一波"><a href="#简单解释一波" class="headerlink" title="简单解释一波"></a>简单解释一波</h2><p>在命令行可以看到这么一句话<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/2.png" alt="" 优化依赖""="" title="">
                </div>
                <div class="image-caption">"优化依赖"</div>
            </figure><br>它会在node_modules下生成一个目录叫.vite_opt_cache，这个文件是做优化用的，第一次运行的时候编译的会有点慢，然后在后面再npm run dev的时候就是毫秒级的（通常玩vue的时候每次npm run dev或者npm run serve的时候都需要进行compiler，将vue等原文件进行编译，然后等compiler进度到100%才跑起来）；vite项目也支持热更， 原因是它不需要compiler，而是将vue文件直接加载，（可以看到在vite项目跑起来的时候的network），然后在后端去处理，也就是一层本地服务，<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/4.png" alt="" network""="" title="">
                </div>
                <div class="image-caption">"network"</div>
            </figure><br>尝试写一个点击增加的demo<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line">&lt;template&gt;</div><div class="line">  &lt;div&gt;count：&#123;&#123;count&#125;&#125;&lt;<span class="regexp">/div&gt;</span></div><div class="line"><span class="regexp">  &lt;button @click="handleClick"&gt;add&lt;/</span>button&gt;</div><div class="line">&lt;<span class="regexp">/template&gt;</span></div><div class="line"><span class="regexp"></span></div><div class="line"><span class="regexp">&lt;script&gt;</span></div><div class="line"><span class="regexp">import &#123;reactive, toRefs&#125; from 'vue';</span></div><div class="line"><span class="regexp">export default &#123;</span></div><div class="line"><span class="regexp">  name: 'App',</span></div><div class="line"><span class="regexp">  setup()&#123;</span></div><div class="line"><span class="regexp">    const state = reactive(&#123;count:0&#125;)</span></div><div class="line"><span class="regexp">    const handleClick = () =&gt; &#123; state.count++ &#125;    </span></div><div class="line"><span class="regexp">    return &#123; ...toRefs(state), handleClick &#125;</span></div><div class="line"><span class="regexp">  &#125;</span></div><div class="line"><span class="regexp">&#125;</span></div><div class="line"><span class="regexp">&lt;/</span>script&gt;</div></pre></td></tr></table></figure></p>
<p>这时候刷新一下然后查看network发现import {reactive, toRefs} from ‘vue’变成了import {reactive, toRefs} from ‘@modules/vue.js’，但是其他import的资源并没有变，而它将我们写的代码变成一个对象，然后再导出，说明vue文件在后端被解析了<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/5.png" alt="" main.js""="" title="">
                </div>
                <div class="image-caption">"main.js"</div>
            </figure><br>将写的demo代码变成了一个对象<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/5.1.png" alt="" 写的demo""="" title="">
                </div>
                <div class="image-caption">"写的demo"</div>
            </figure><br>再看看index.html里面对于js的引入<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/6.png" alt="network''" title="">
                </div>
                <div class="image-caption">network''</div>
            </figure><br>它是直接引入的main.js文件而且type是module，也就是以es module的方式进行引入，采用了原生es6的模块，而es module每次进行import的时候都会默认发送一个请求，这时候再通过node服务去做资源处理然后直接返回，所以项目整体没有看到需要配置webpack的地方，也实现了免编译。</p>
<h2 id="为什么import的vue资源变成了-modules"><a href="#为什么import的vue资源变成了-modules" class="headerlink" title="为什么import的vue资源变成了/@modules?"></a>为什么import的vue资源变成了/@modules?</h2><p>因为服务一启动，就会加载main.js，而main.js又import了vue,浏览器不支持这种方式，会报这样的错误<br><figure class="highlight javascript"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">Uncaught <span class="built_in">TypeError</span>: Failed to resolve <span class="built_in">module</span> specifier <span class="string">"vue"</span>. Relative references must start <span class="keyword">with</span> either <span class="string">"/"</span>, <span class="string">"./"</span>, or <span class="string">"../"</span>.</div></pre></td></tr></table></figure></p>
<p>为了在加载资源的时候不会报错，所以需要加上/@modules前缀（也可以加上/@abc或者/@xiaofangkuai或者/@hardy等）进行模块重写</p>
<h2 id="为什么-modules之后资源就可用了？"><a href="#为什么-modules之后资源就可用了？" class="headerlink" title="为什么/@modules之后资源就可用了？"></a>为什么/@modules之后资源就可用了？</h2><p>因为在vite运行之后，node服务会根据静态服务执行的目录去获取.js文件也就是main.js进行重写，再将重写后的内容返回，可以在vite源码的node部分看到这一段<br><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="/images/vite/8.jpg" alt="rewrite''" title="">
                </div>
                <div class="image-caption">rewrite''</div>
            </figure><br>返回的重写内容里面如果有import xx from ‘/@modules/aaa’，则会继续发一个aaa的请求，所以重写之后会对带有@modules前缀（加载第三方模块）的请求进行处理，也就是根据前缀去node_modules里头读取对应的真实的资源（运行时）然后把读取出来的结果以.js的类型返回</p>
<p>另外附上一个比较简单版的vite，可以直接拖下来看，它在这里<a href="https://github.com/HHardyy/vite-demo" target="_blank" rel="external">‘https://github.com/HHardyy/vite-demo’</a></p>
<p>这一波通宵我感觉我的青春又回来了~~~</p>

        </div>

        <blockquote class="post-copyright">
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-07-18T20:45:13.077Z" itemprop="dateUpdated">2020-07-19 04:45:13</time>
</span><br>


        
        谢谢浏览，我会继续努力的，示例：<a href="/2020/07/19/vite秒开揭秘/" target="_blank" rel="external">http://yoursite.com/2020/07/19/vite秒开揭秘/</a>
        
    </div>
    <footer>
        <a href="http://yoursite.com">
            <img src="/img/avatar.jpg" alt="BingZhenhuang">
            BingZhenhuang
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vite/">vite</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vue3/">vue3</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2020/07/19/vite秒开揭秘/&title=《vite秒开揭秘》 — 小方块 - hhardyy.com&pic=http://yoursite.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2020/07/19/vite秒开揭秘/&title=《vite秒开揭秘》 — 小方块 - hhardyy.com&source=尤雨溪直播介绍vue3的时候，说到了他正在做的一个新东西，名叫vite。
" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2020/07/19/vite秒开揭秘/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《vite秒开揭秘》 — 小方块 - hhardyy.com&url=http://yoursite.com/2020/07/19/vite秒开揭秘/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2020/07/19/vite秒开揭秘/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between flex-row-reverse">
  

  
    <div class="waves-block waves-effect next">
      <a href="/2020/03/14/React-hooks/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">React hooks</h4>
      </a>
    </div>
  
</nav>



    














</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        🤠 请我喝可乐！
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content" style="width:50%">
        
        <div class="reward-code" style="text-align:center">
            <div style="width:300px;margin:0px auto;">
               <img id="rewardCode" style="width:50%;height:60%;display:block; margin:0px auto;" src="/img/alipay.jpg" alt="支付宝打赏二维码">
               <span style="display:inline-block; margin-bottom:20px;">0.88(支付宝 aliPay)</span>
               <img id="rewardCode" style="width:50%;height:60%;display:block; margin:0px auto;" src="/img/wechat.jpg" alt="微信打赏二维码">
               <span style="display:inline-block;">0.88(微信 weChat)</span>
            </div>
        </div>
    </div>
</div>



</div>

        <script>
!function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document);
</script>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<script>
    function secondToDate(second) {
        if (!second) {
            return 0;
        }
        var time = new Array(0, 0, 0, 0, 0);
        if (second >= 365 * 24 * 3600) {
            time[0] = parseInt(second / (365 * 24 * 3600));
            second %= 365 * 24 * 3600;
        }
        if (second >= 24 * 3600) {
            time[1] = parseInt(second / (24 * 3600));
            second %= 24 * 3600;
        }
        if (second >= 3600) {
            time[2] = parseInt(second / 3600);
            second %= 3600;
        }
        if (second >= 60) {
            time[3] = parseInt(second / 60);
            second %= 60;
        }
        if (second > 0) {
            time[4] = second;
        }
        return time;
    }</script>
<script type="text/javascript" language="javascript">
    function setTime() {
        var create_time = Math.round(new Date(Date.UTC(2017, 08, 18, 11, 42, 23)).getTime() / 1000);
        var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
        currentTime = secondToDate((timestamp - create_time));
        currentTimeHtml = 'Running：' + currentTime[0] + '年 ' + currentTime[1] + '天 '
                + currentTime[2] + '时 ' + currentTime[3] + '分 ' + currentTime[4]
                + '秒';
        document.getElementById("htmer_time").innerHTML = currentTimeHtml;
    }    setInterval(setTime, 1000);
</script>
<footer class="footer">
    <div class="top">
        

        <p>
          <span id="busuanzi_container_page_pv">
             [&nbsp;浏览量：&nbsp;<span id="busuanzi_value_page_pv"></span>&nbsp;]
          </span>
        </p>
    </div>
    <div class="bottom">
        <p>
        <span>BingZhenhuang &copy; 2017 - 2020</span>
            <span>
                
                Power by <a href="https://hhardyy.github.io/" target="_blank">zhen On August 8</a> 
            </span>
            <span id="htmer_time" "></span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2020/07/19/vite秒开揭秘/&title=《vite秒开揭秘》 — 小方块 - hhardyy.com&pic=http://yoursite.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2020/07/19/vite秒开揭秘/&title=《vite秒开揭秘》 — 小方块 - hhardyy.com&source=尤雨溪直播介绍vue3的时候，说到了他正在做的一个新东西，名叫vite。
" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2020/07/19/vite秒开揭秘/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《vite秒开揭秘》 — 小方块 - hhardyy.com&url=http://yoursite.com/2020/07/19/vite秒开揭秘/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2020/07/19/vite秒开揭秘/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>








<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '(•‾̑⌣‾̑•)✧˖°回来看我';
            clearTimeout(titleTime);
        } else {
            document.title = '(゜-゜)つロ欢迎回来';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
